<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <style>
        button{
            background: aquamarine;
        }
        h1{
            color: aqua;
        }
    </style>
    <body>
            <button id="a">开始</button>
            <button id="b">结束</button>
            <h1 id="c">抽奖！</h1>
        <script>
            var tag=document.getElementById('c');
            var start=document.getElementById('a');
            var end=document.getElementById('b');
            var timer;
            var list=['1','2','3','4','5','6','7','8','9','10'];
            console.log(list[0]);
            console.log(list.length);
            start.onclick=function(){
                clearInterval(timer);
                timer=setInterval(function(){
                    var n=parseInt(Math.random()*list.length);
                    tag.innerHTML=list[n]
                },10)
            }
            end.onclick=function(){
                clearInterval(timer);
            }
        </script>
    </body>
</html>